﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace mozhi.smarterp.AuthorCenter.Migrations
{
    public partial class _202412161710 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_AbpPermissionGroup_AbpPermissionGroup_PermissionGroupId",
                table: "AbpPermissionGroup");

            migrationBuilder.DropIndex(
                name: "IX_AbpPermissionGroup_PermissionGroupId",
                table: "AbpPermissionGroup");

            migrationBuilder.DropColumn(
                name: "PermissionGroupId",
                table: "AbpPermissionGroup");

            migrationBuilder.RenameColumn(
                name: "TenantId",
                table: "AbpPermissionItem",
                newName: "PermissionGroupId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpPermissionItem_PermissionGroupId",
                table: "AbpPermissionItem",
                column: "PermissionGroupId");

            migrationBuilder.AddForeignKey(
                name: "FK_AbpPermissionItem_AbpPermissionGroup_PermissionGroupId",
                table: "AbpPermissionItem",
                column: "PermissionGroupId",
                principalTable: "AbpPermissionGroup",
                principalColumn: "Id");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_AbpPermissionItem_AbpPermissionGroup_PermissionGroupId",
                table: "AbpPermissionItem");

            migrationBuilder.DropIndex(
                name: "IX_AbpPermissionItem_PermissionGroupId",
                table: "AbpPermissionItem");

            migrationBuilder.RenameColumn(
                name: "PermissionGroupId",
                table: "AbpPermissionItem",
                newName: "TenantId");

            migrationBuilder.AddColumn<Guid>(
                name: "PermissionGroupId",
                table: "AbpPermissionGroup",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.CreateIndex(
                name: "IX_AbpPermissionGroup_PermissionGroupId",
                table: "AbpPermissionGroup",
                column: "PermissionGroupId");

            migrationBuilder.AddForeignKey(
                name: "FK_AbpPermissionGroup_AbpPermissionGroup_PermissionGroupId",
                table: "AbpPermissionGroup",
                column: "PermissionGroupId",
                principalTable: "AbpPermissionGroup",
                principalColumn: "Id");
        }
    }
}
